package com.wangde.bean;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

@Slf4j
public class BeanTest {
    public static void main(String[] args) {
        log.debug("start test");
        testSpringBean();
        log.debug("end test");
    }

    public static void testStand(){
        Chinese p = new Chinese();
        StoneAxe axe = new StoneAxe();
        p.setAxe(axe);
        p.useAxe();
    }

    public static void testSpringBean() {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
        Person p = ctx.getBean("chinese", Person.class);
        p.useAxe();
    }
}